<?php /*a:1:{s:67:"C:\phpstudy_pro\WWW\zg2\pyg_shoop\tp\app\admin\view\index\list.html";i:1668762321;}*/ ?>

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/static/lib/html5shiv.js"></script>
    <script type="text/javascript" src="/static/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/static/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/static/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/static/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/static/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/static/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="/static/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>用户管理</title>
</head>
<body>
<div class="pd-20">
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="text-c">
        <input type="text" class="input-text" style="width:250px" placeholder="输入会员名称、电话、邮箱" id="" name=""><button type="submit" class="btn btn-success" id="" name=""><i class="icon-search"></i> 搜用户</button>

    </div>
    <div class="cl pd-5 bg-1 bk-gray mt-20">
    <span class="l"><a href="Javascript:;" onclick="delAll()" class="btn btn-danger radius"><i class="icon-trash"></i> 批量删除</a>&emsp;
    <a href="add" class="btn btn-primary radius"><i class="icon-plus"></i> 添加分类</a></span>&emsp;
    <a href="huis" class="btn btn-success radius"><i class="icon-plus"></i> 回收站</a></span>
        <span class="r">共有数据：<strong><?php echo htmlentities($data->total()); ?></strong> 条</span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg table-sort">
        <thead>
        <tr class="text-c">
            <th><input type="checkbox" class="checkAll"></th>
            <th>ID</th>
            <th>分类名称</th>
            <th>顶级分类</th>
            <th>图片</th>
            <th>状态</th>
            <th>排序</th>
            <th>省</th>
            <th>市</th>
            <th>区/县</th>
            <th>操作</th>
        </tr>
        </thead>

        <tbody>
        <?php if(is_array($data) || $data instanceof \think\Collection || $data instanceof \think\Paginator): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
        <tr class="text-c">
            <td><input type="checkbox" value="<?php echo htmlentities($v['id']); ?>" name="ids[]" ></td>
            <td><?php echo htmlentities($v['id']); ?></td>
            <td><?php echo htmlentities($v['name']); ?></td>
            <td><?php echo htmlentities($v['tname']); ?></td>
            <td><img src="/storage/<?php echo htmlentities($v['img']); ?>" width="50"></td>
            <td onclick="stn(this,$id=<?php echo htmlentities($v['id']); ?>)">
                <?php if(($v['stater']==1)): ?>
                <span class="btn" >显示</span>
                <?php else: ?>
                <span class="btn">隐藏</span>
                <?php endif; ?>
            </td>
            <td><?php echo htmlentities($v['order']); ?></td>
            <td><?php echo htmlentities($v['province']['name']); ?></td>
            <td><?php echo htmlentities($v['city']['name']); ?></td>
            <td><?php echo htmlentities($v['area']['name']); ?></td>
            <td class="f-14 user-manage"><a href="Javascript:;" data-id="<?php echo htmlentities($v['id']); ?>" class="del">删除</a> <button>编辑</button></td>
        </tr>
        <?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
    </table>
    <?php echo $data; ?>
    <div id="pageNav" class="pageNav"></div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/static/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/static/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/static/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/static/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/static/lib/datatables/1.10.15/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/lib/laypage/1.2/laypage.js"></script>
<script>
    function stn($this,id){
        $.ajax({
            type:'post',
            url:'/admin/index/updei',
            dataType:'json',
            data:{id:id},
            success:function (res) {
               if(res.status==1){
                   layer.msg(res.msg,{icon:1},function () {
                       $($this).html("<span class='btn'>"+res.html+"</span>")
                   })
               }
            }
        })
    }
   $('.del').click(function () {
        let id=$(this).data('id');
        $.ajax({
            type:'post',
            url: '/admin/index/delete',
            dataType: 'json',
            data:{id:id},
            success:function (res) {
                if(res.status==1){
                    layer.msg(res.msg,{icon:1},function () {
                        window.location.href="/admin/index/list";
                    })
                }
            }
        });
   })

 $('.checkAll').click(function () {
    $("input[name='ids[]']").prop("checked",$(this).prop("checked"))
 })
    function delAll() {
        let ids=[];
        $("input[name='ids[]']:checked").each(function (k,v) {
            // console.log(k,v)
            ids.push($(v).val())
        })
        // console.log(ids);
        // console.log(ids.length);
        if(ids.length ==0){
            // console.log(ids.length);
            return  layer.msg('总得选一个吧')
        }
        layer.confirm('确定要删除吗？',function () {
            $.ajax({
                type:'post',
                url:'/admin/index/delete',
                dataType:'json',
                data:{id:ids},
                success:function (res) {
                    if(res.status==1){
                        layer.msg(res.msg,{icon:1},function () {
                            window.location.href='/admin/index/list';
                        })
                    }
                }
            })
        })
    }



</script>
</body>
</html>
